package zzcltw.com.action;

import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;



/**
 * 通用类
 */
public class CommonAction {
	public static final Map<String,Object> convert(HttpServletRequest request){
		Map<String,Object> param=new HashMap<String, Object>();
		Enumeration<String> e=request.getParameterNames();
		String name="";
		String str[]=null;
		while(e.hasMoreElements()){
			name=e.nextElement();
			str=request.getParameterValues(name);
			name=name.replace("[", "").replace("]", "");
			if(str.length==1)
				param.put(name, str[0].replaceAll("\"", "\\\"").replaceAll("\'", "\\\'").replaceAll("<", "<").replaceAll(">", ">"));
			else{
				for(int i=0;i<str.length;i++)
					str[i]=str[i].replaceAll("\"", "\\\"").replaceAll("\'", "\\\'").replaceAll("<", "<").replaceAll(">", ">");
				param.put(name, str);
			}
		}
		return param;
	}

}
